#include"BackGroundLayer.h"
#include"SecondScene.h"
#include<string>
USING_NS_CC;
using namespace std;

#pragma comment(lib,"libcocos2d.lib")

BackGroundLayer::BackGroundLayer()
{
}

BackGroundLayer::~BackGroundLayer()
{
}

bool BackGroundLayer::init()
{
	if (Layer::init())
	{
		cocos2d::Size backSize = Director::getInstance()->getWinSize();
		CCSprite* backgorund = CCSprite::create("bg.png");
		backgorund->setPosition(CCPointMake(backSize.width*0.5, backSize.height*0.5));
		this->addChild(backgorund);

		return true;
	}
	return false;
}

void BackGroundLayer::visit(cocos2d::Renderer * renderer, const cocos2d::Mat4 & parentTransform, uint32_t parentFlags)
{
	glEnable(GL_SCISSOR_TEST);
	glScissor(100, 100, 200, 200);
	Node::visit(renderer, parentTransform, parentFlags);
	glDisable(GL_SCISSOR_TEST);
}

